import qs from 'qs'
import { request } from '@/utils/request'
import { ID } from '@/types'

export type LoginUserRequest = {
  phone: string;
  password: string;
}

export function login (user: LoginUserRequest) {
  return request.post('/front/user/login', qs.stringify(user))
}

export function getUserInfo () {
  return request.get('/front/user/getInfo')
}

export function getUserPages (query: {
  'currentPage': number;
  'pageSize': number;
  'phone': string;
  'startCreateTime': string;
  'endCreateTime': string;
}) {
  return request.post('/boss/user/getUserPages', query)
}

export function getUserRoles (userId: ID) {
  return request.get(`/boss/role/user/${userId}`)
}
